package br.mikhas.refractor.method;

import br.mikhas.refractor.AnnotatedElement;

/**
 * Defines methods handle methods.
 * 
 * @author Mikhail Domanoski
 * 
 */
public interface MethodProxy extends AnnotatedElement {
	/**
	 * Gets the name of the method
	 * 
	 * @return The name of the method
	 */
	public String name();

	/**
	 * Invokes the method passing it's parameters
	 * 
	 * @param args
	 *            The method arguments
	 * @return The return value of the method
	 */
	public Object invoke(Object... args);

	/**
	 * Invokes the method without passing parameters
	 * 
	 * @return The method return value
	 */
	public Object invoke();

	/**
	 * Checks if the method is static
	 * 
	 * @return <code>true</code> is it's an static method
	 */
	public boolean isStatic();

	/**
	 * Gets the method return type
	 * 
	 * @return the return type
	 */
	public Class<?> type();

	/**
	 * Gets an array with the parameter definition and metadata
	 * 
	 * @return an array with the method parameters
	 */
	public Parameter[] parameters();

	/**
	 * Causes the proxy to create a native method invoker for faster method
	 * calls.
	 * <p>
	 * The method should not be extensible used because the creation of the
	 * native invoker takes some processing time.
	 * <p>
	 * Native invokers use is strict to instance methods.
	 */
	public void useNativeInvoker();
}
